﻿using System;
using System.Diagnostics;
using System.Xml.Serialization;

namespace PrearrangedChaos.AgileZen.Service.Model
{
    /// <remarks/>
    [DebuggerStepThrough()]
    [XmlType(AnonymousType = true)]
    [XmlRootAttribute(ElementName = "step", Namespace = "", IsNullable = false)]
    public partial class Step : IStep
    {
        private TimeSpan _duration;

        /// <remarks/>
        [XmlElement(ElementName = "duration")]
        public int DurationXmlElement
        {
            get { return (int)this.Duration.TotalSeconds;  }
            set { this._duration = TimeSpan.FromSeconds(value); }
        }

        [XmlElement]
        public TimeSpan Duration
        {
            get { return _duration; }
            set { _duration = value; }
        }

        /// <remarks/>
        [XmlElement(ElementName = "id")]
        public int Id { get; set; }

        /// <remarks/>
        [XmlElement(ElementName = "startTime")]
        public DateTime StartTime { get; set; }

        /// <remarks/>
        [XmlElement(ElementName = "endTime")]
        public DateTime EndTime { get; set; }

        private string _type;

        /// <remarks/>
        [XmlElement(ElementName = "type")]
        public string Type
        {
            get { return _type; }
            set
            {
                if (!string.IsNullOrEmpty(value))
                    _type = value;
                else
                    _type = null;
            }
        }
    }
}